package 作业;

import java.util.*;

public class one {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        Map map=new HashMap();
        map.put(1930,"乌拉圭");
        map.put(1934,"意大利");
        map.put(1938,"意大利");
        map.put(1950,"乌拉圭");
        map.put(1954,"西德");
        map.put(1958,"巴西");
        map.put(1962,"巴西");
        map.put(1966,"英格兰");
        map.put(1970,"巴西");
        map.put(1974,"西德");
        map.put(1978,"阿根廷");
        map.put(1982,"意大利");
        map.put(1986,"阿根廷");
        map.put(1990,"西德");
        map.put(1994,"巴西");
        map.put(1998,"法国");
        map.put(2002,"巴西");
        map.put(2006,"意大利");
        map.put(2010,"西班牙");
        map.put(2014,"德国");

        System.out.println("欢迎来到世界杯查询网站");
        System.out.println("请输入一个年份");
        Set keySet=map.keySet();
        Iterator KeyIt=keySet.iterator();
        int num=input.nextInt();
        String names=(String) map.get(num);
        if (map.containsKey(num)){

            Iterator keys = map.keySet().iterator();
            while(keys.hasNext()){
                int key = (int)keys.next();

                if(num==(key)){
                    System.out.println("今年的世界杯队伍是:"+names);
                }
            }
        }else{
                System.out.println("没有举办世界杯");
            }
            System.out.println("请输入一只夺冠球队的名字");
            String name=input.next();
            if (name.equals(names)){
                Set keySet1=map.keySet();
                Iterator KeyIt1=keySet.iterator();
                while(KeyIt1.hasNext()){
                    int number=(int)KeyIt1.next();
                    if (map.get(number).equals(name)){
                        System.out.println(number);
                    }

            }
        }else{
            System.out.println("该球队没有夺冠过");
        }









    }
}
